﻿namespace PrismEx.Fixtures.Modules.Navigation
{
    using Microsoft.Practices.Prism.Events;
    using Microsoft.Practices.Prism.Regions;

    using Moq;

    using PrismEx.Events.Navigation;
    using PrismEx.Modules;
    using PrismEx.Modules.NavigationService;

    using Stump;

    public class NavigationModuleSubscriptionFixture : Stump.TestFixtureBase<IEventAggregator>
    {
        private IEventAggregator eventAggregator;

        private NavigateUriEvent navigateUriEvent;

        public override void Given()
        {
            eventAggregator = new Mock<IEventAggregator>().Object;
            navigateUriEvent = new Mock<NavigateUriEvent>().Object;

            Mock.Get(eventAggregator).Setup(x => x.GetEvent<NavigateUriEvent>()).Returns(navigateUriEvent);

        }

        public override void When()
        {
            var navigationModule = new NavigationServiceModule(eventAggregator, new Mock<IRegionManager>().Object);
            navigationModule.Initialize();
        }

        [Then]
        public void Should_subscribe_to_RequestNavigateUri()
        {
            Mock.Get(eventAggregator).Verify(x => x.GetEvent<NavigateUriEvent>());
        }
    }
}